﻿using System;
using System.Collections.Generic;

namespace Jodell.Transport.Ethercat
{
    public class Device
    {
        public string Physics { get; set; }
        public UInt32 ProductCode { get; set; }
        public UInt16 RevisionNo { get; set; }
        public string Name { get; set; }
        public string Image { get; set; }
        public string GroupType { get; set; }

        public List<Ob_SubItem> RxPdo { get; private set; } = new List<Ob_SubItem>();
        public List<Entry> TxPdo { get; private set; } = new List<Entry>();
        public List<Ob_SubItem> Sdo { get; set; } = new List<Ob_SubItem>();
        /// <summary>
        /// Sdo Bit Size
        /// </summary>
        public int BitSize { get; set; }

        public Info Info { get; set; }

        public Profile Profile { get; set; }
    }
   

   
   
    public class Eeprom
    {
        public int ByteSize { get; set; }
        public string ConfigData { get; set; }
        public string BootStrap { get; set; }
    }

    public class Info
    {
        public StateMachine StateMachine { get; set; }
        public Mailbox Mailbox { get; set; }
    }
    public class StateMachine
    {
        public int PreopTimeout { get; set; }
        public int SafeopOpTimeout { get; set; }
        public int BackToInitTimeout { get; set; }
        public int BackToSafeopTimeout { get; set; }
    }
    public class Mailbox
    {
        public int RequestTimeout { get; set; }
        public int ResponseTimeout { get; set; }
    }

    public class Pro_DataType
    {
        public string Name { get; set; }
        public int BitSize { get; set; }
        public List<Pro_DataType_SubItem> SubItems { get; set; }
    }
    public class Pro_DataType_SubItem
    {
        public byte SubIdx { get; set; }
        public string Name { get; set; }
        public string Type { get; set; }
        public string Comment { get; set; }
        public int BitSize { get; set; }
        public int BitOffs { get; set; }
        public Flags Flags { get; set; }
    }

    public class Pro_Object
    {
        public UInt16 Index { get; set; }
        public string Name { get; set; }
        public string Type { get; set; }
        public int BitSize { get; set; }
        public Pro_Object_Info Info { get; set; }
        public Flags Flags { get; set; }
    }

    public class Pro_Object_Info
    {
        public string DefaultData { get; set; }
    }
    public class ArrayInfo
    {
        public int LBound { get; set; }
        public int Elements { get; set; }
    }
    public class Dt_SubItem
    {
        public byte SubIdx { get; set; }
        public string Name { get; set; }
        public string Type { get; set; }
        public string Comment { get; set; }
        public int BitSize { get; set; }
        public int BitOffs { get; set; }
        public Flags Flags { get; set; }
        public ArrayInfo ArrayInfo { get; set; }
    }

    public class Profile
    {
        public int ProfileNo { get; set;}
        public List<Pro_DataType> DataTypes { get; set; }
        public List<Pro_Object> Objects { get; set; }
    }
}
